<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/2/25
  Time: 12:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品类别</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>
<body>
<button class="layui-btn">添加</button>
<table id="myTable"></table>
<script type="text/html" id="bar1">
    <a class="layui-btn layui-btn-xs" lay-event="#">查看下级</a>
    <a class="layui-btn layui-btn-xs" lay-event="#">转移商品</a>
</script>
<script type="text/html" id="bar2">
    <a class="layui-btn layui-btn-xs" lay-event="upd">编辑</a>
    <a class="layui-btn layui-btn-xs" lay-event="del">删除</a>
</script>
<!--layui代码-->
<script>
    layui.use(['table'],function () {
        var table = layui.table;
        var $ = layui.$;
        table.render({
            elem:'#myTable',
            url:'category/select',
            page:true,
            limit:3,
            limits:[3,4,5],
            cols:[[
                {field:'id',title:'编号',width:80, sort: true},
                {field:'name',title:'分类名称',width:80, sort: true},
                {field:'level',title:'级别',width:80, sort: true},
                {field:'product_count',title:'商品数量',width:80, sort: true},
                {title:'数量单位',templet:function (d) {
                        return '件'
                    }},
                {field:'nav_status',title:'导航栏',templet:function (d) {
                        if(d.nav_status==0){
                            return '不显示导航'
                        }else{
                            return '显示导航'
                        }
                    }},
                {field:'show_status',title:'是否显示',templet:function (d) {
                        if(d.show_status==0){
                            return '不显示'
                        }else{
                            return '显示'
                        }
                    }},
                {field:'sort',title:'排序',width:80, sort: true},
                {title:'设置',toolbar:'#bar1'},
                {title:'操作',toolbar:'#bar2'},
            ]]
        })
    })
</script>
</body>
</html>
